package singleton;

public class PrintSpoolerSingleton {

    private static volatile PrintSpoolerSingleton instance = null;

    private PrintSpoolerSingleton() {
        System.out.println("创建打印池！");
    }

    public static PrintSpoolerSingleton getInstance() {
        if (instance == null) {
            synchronized (PrintSpoolerSingleton.class) {
                if (instance == null) {
                    instance = new PrintSpoolerSingleton();
                }
            }
        }
        return instance;  // 始终返回同一个实例
    }

    public void manageJobs() {
        System.out.println("管理打印任务！");
    }
}
